\hypertarget{namespacecalico_1_1utils}{}\doxysection{calico\+::utils Namespace Reference}
\label{namespacecalico_1_1utils}\index{calico::utils@{calico::utils}}


Utils namespace.  


\doxysubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum class \mbox{\hyperlink{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9}{Loss\+Function\+Type}} \+: int \{ \mbox{\hyperlink{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a35c3ace1970663a16e5c65baa5941b13}{k\+None}}
, \mbox{\hyperlink{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a084edafec56dd4f16e59c49086cd996b}{k\+Huber}}
, \mbox{\hyperlink{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a837525318a461e4a282986beb74c0211}{k\+Cauchy}}
 \}
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
ceres\+::\+Loss\+Function $\ast$ \mbox{\hyperlink{namespacecalico_1_1utils_aeee1e1f3baea4f1b75efab0c42923dcf}{Create\+Loss\+Function}} (\mbox{\hyperlink{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9}{Loss\+Function\+Type}} loss, double scale)
\item 
int \mbox{\hyperlink{namespacecalico_1_1utils_ac4ef701716e2efff5e392c94bbb0e7ed}{Add\+Pose\+To\+Problem}} (ceres\+::\+Problem \&problem, \mbox{\hyperlink{classcalico_1_1Pose3}{Pose3d}} \&pose)
\item 
void \mbox{\hyperlink{namespacecalico_1_1utils_a86079fbae8165d8052d293a2cad53079}{Set\+Pose\+Constant\+In\+Problem}} (ceres\+::\+Problem \&problem, \mbox{\hyperlink{classcalico_1_1Pose3}{Pose3d}} \&pose)
\item 
Tuple\mbox{[}np.\+ndarray, np.\+ndarray, np.\+ndarray\mbox{]} \mbox{\hyperlink{namespacecalico_1_1utils_a08187b96fdb074b396a567445728fc24}{Compute\+Rmse\+Heatmap\+And\+Feature\+Count}} (List\mbox{[}Tuple\mbox{[}calico.\+Camera\+Measurement, np.\+ndarray\mbox{]}\mbox{]} measurement\+\_\+residual\+\_\+pairs, int image\+\_\+width, int image\+\_\+height, int num\+\_\+rows=8, int num\+\_\+cols=12)
\item 
np.\+ndarray \mbox{\hyperlink{namespacecalico_1_1utils_ab29403023fb9f34b112df40539a1575e}{Draw\+Detections}} (np.\+ndarray img, Dict\mbox{[}int, np.\+ndarray\mbox{]} detections)
\item 
List\mbox{[}calico.\+Camera\+Measurement\mbox{]} \mbox{\hyperlink{namespacecalico_1_1utils_a8d494be062edb3f17713a05cca535acc}{Detections\+To\+Camera\+Measurements}} (Dict\mbox{[}int, np.\+ndarray\mbox{]} detections, float stamp, int seq)
\item 
Tuple\mbox{[}np.\+ndarray, List\mbox{[}np.\+ndarray\mbox{]}, List\mbox{[}np.\+ndarray\mbox{]}\mbox{]} \mbox{\hyperlink{namespacecalico_1_1utils_a2002680e62d88f21a336fefa40f0c50c}{Initialize\+Pinhole\+And\+Poses}} (List\mbox{[}Dict\mbox{[}int, np.\+ndarray\mbox{]}\mbox{]} all\+\_\+detections, Dict\mbox{[}int, np.\+ndarray\mbox{]} model\+\_\+definition)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Utils namespace. 

\begin{DoxyVerb}@package Python utils
Utility functions for calico python bindings.
\end{DoxyVerb}
 

\doxysubsection{Enumeration Type Documentation}
\mbox{\Hypertarget{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9}\label{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9}} 
\index{calico::utils@{calico::utils}!LossFunctionType@{LossFunctionType}}
\index{LossFunctionType@{LossFunctionType}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{LossFunctionType}{LossFunctionType}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9}{calico\+::utils\+::\+Loss\+Function\+Type}} \+: int\hspace{0.3cm}{\ttfamily [strong]}}

Loss\+Function\+Type. For more information, visit the \href{http://ceres-solver.org/nnls_modeling.html?highlight=loss\%20function\#lossfunction}{\texttt{ Ceres Solver documentation page on loss functions}} \begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{kNone@{kNone}!calico::utils@{calico::utils}}\index{calico::utils@{calico::utils}!kNone@{kNone}}}\mbox{\Hypertarget{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a35c3ace1970663a16e5c65baa5941b13}\label{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a35c3ace1970663a16e5c65baa5941b13}} 
k\+None&Standard least-\/squares. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{kHuber@{kHuber}!calico::utils@{calico::utils}}\index{calico::utils@{calico::utils}!kHuber@{kHuber}}}\mbox{\Hypertarget{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a084edafec56dd4f16e59c49086cd996b}\label{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a084edafec56dd4f16e59c49086cd996b}} 
k\+Huber&Huber loss. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{kCauchy@{kCauchy}!calico::utils@{calico::utils}}\index{calico::utils@{calico::utils}!kCauchy@{kCauchy}}}\mbox{\Hypertarget{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a837525318a461e4a282986beb74c0211}\label{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9a837525318a461e4a282986beb74c0211}} 
k\+Cauchy&Cauchy loss. \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{namespacecalico_1_1utils_ac4ef701716e2efff5e392c94bbb0e7ed}\label{namespacecalico_1_1utils_ac4ef701716e2efff5e392c94bbb0e7ed}} 
\index{calico::utils@{calico::utils}!AddPoseToProblem@{AddPoseToProblem}}
\index{AddPoseToProblem@{AddPoseToProblem}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{AddPoseToProblem()}{AddPoseToProblem()}}
{\footnotesize\ttfamily int calico\+::utils\+::\+Add\+Pose\+To\+Problem (\begin{DoxyParamCaption}\item[{ceres\+::\+Problem \&}]{problem,  }\item[{\mbox{\hyperlink{classcalico_1_1Pose3}{Pose3d}} \&}]{pose }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

Convenience function for adding a Pose3d type to a ceres problem with correct parameterization and manifold specification. \mbox{\Hypertarget{namespacecalico_1_1utils_a08187b96fdb074b396a567445728fc24}\label{namespacecalico_1_1utils_a08187b96fdb074b396a567445728fc24}} 
\index{calico::utils@{calico::utils}!ComputeRmseHeatmapAndFeatureCount@{ComputeRmseHeatmapAndFeatureCount}}
\index{ComputeRmseHeatmapAndFeatureCount@{ComputeRmseHeatmapAndFeatureCount}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{ComputeRmseHeatmapAndFeatureCount()}{ComputeRmseHeatmapAndFeatureCount()}}
{\footnotesize\ttfamily  Tuple\mbox{[}np.\+ndarray, np.\+ndarray, np.\+ndarray\mbox{]} calico.\+utils.\+Compute\+Rmse\+Heatmap\+And\+Feature\+Count (\begin{DoxyParamCaption}\item[{List\mbox{[}Tuple\mbox{[}calico.\+Camera\+Measurement, np.\+ndarray\mbox{]}\mbox{]}}]{measurement\+\_\+residual\+\_\+pairs,  }\item[{int}]{image\+\_\+width,  }\item[{int}]{image\+\_\+height,  }\item[{int }]{num\+\_\+rows = {\ttfamily 8},  }\item[{int }]{num\+\_\+cols = {\ttfamily 12} }\end{DoxyParamCaption})}

\begin{DoxyVerb} Compute the RMSE heatmap with specified resolution.

Args:
  measurement_residual_pairs:
    List of camera measurements paired with their residuals.
  image_width:
    Width of the original image.
  image_height:
    Height of the original image.
  num_rows:
    Number of rows we want to divide the image into.
  num_cols:
    Number of columns we want to divide the image into.

Returns:
  A tuple containing:
    1. An rmse heatmap image with dimensions image_width x image_height.
    2. A binned version of the RMSE heatmap as a num_rows x num_cols array.
    3. A num_rows x num_cols array representing the number of features detected
       in a particular region of the image space.
\end{DoxyVerb}
 \mbox{\Hypertarget{namespacecalico_1_1utils_aeee1e1f3baea4f1b75efab0c42923dcf}\label{namespacecalico_1_1utils_aeee1e1f3baea4f1b75efab0c42923dcf}} 
\index{calico::utils@{calico::utils}!CreateLossFunction@{CreateLossFunction}}
\index{CreateLossFunction@{CreateLossFunction}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{CreateLossFunction()}{CreateLossFunction()}}
{\footnotesize\ttfamily ceres\+::\+Loss\+Function$\ast$ calico\+::utils\+::\+Create\+Loss\+Function (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{namespacecalico_1_1utils_aacede3df540b75d2e131f113380f0ce9}{Loss\+Function\+Type}}}]{loss,  }\item[{double}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

Convenience function for allocating a {\ttfamily ceres\+::\+Loss\+Function} object of of specified type and scale. For more information, visit the \href{http://ceres-solver.org/nnls_modeling.html?highlight=loss\%20function\#lossfunction}{\texttt{ Ceres Solver documentation page on loss functions}} \mbox{\Hypertarget{namespacecalico_1_1utils_a8d494be062edb3f17713a05cca535acc}\label{namespacecalico_1_1utils_a8d494be062edb3f17713a05cca535acc}} 
\index{calico::utils@{calico::utils}!DetectionsToCameraMeasurements@{DetectionsToCameraMeasurements}}
\index{DetectionsToCameraMeasurements@{DetectionsToCameraMeasurements}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{DetectionsToCameraMeasurements()}{DetectionsToCameraMeasurements()}}
{\footnotesize\ttfamily  List\mbox{[}calico.\+Camera\+Measurement\mbox{]} calico.\+utils.\+Detections\+To\+Camera\+Measurements (\begin{DoxyParamCaption}\item[{Dict\mbox{[}int, np.\+ndarray\mbox{]}}]{detections,  }\item[{float}]{stamp,  }\item[{int}]{seq }\end{DoxyParamCaption})}

\begin{DoxyVerb}Convenience function for converting a calibration chart detection into
camera measurement types.
\end{DoxyVerb}
 \mbox{\Hypertarget{namespacecalico_1_1utils_ab29403023fb9f34b112df40539a1575e}\label{namespacecalico_1_1utils_ab29403023fb9f34b112df40539a1575e}} 
\index{calico::utils@{calico::utils}!DrawDetections@{DrawDetections}}
\index{DrawDetections@{DrawDetections}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{DrawDetections()}{DrawDetections()}}
{\footnotesize\ttfamily  np.\+ndarray calico.\+utils.\+Draw\+Detections (\begin{DoxyParamCaption}\item[{np.\+ndarray}]{img,  }\item[{Dict\mbox{[}int, np.\+ndarray\mbox{]} }]{detections }\end{DoxyParamCaption})}

\begin{DoxyVerb}Small helper function for drawing detections onto the original image.

Args:
  img: Original grayscale image.
  detections: Dictionary mapping feature id to its pixel location.

Returns:
  Color image with detections drawn.
\end{DoxyVerb}
 \mbox{\Hypertarget{namespacecalico_1_1utils_a2002680e62d88f21a336fefa40f0c50c}\label{namespacecalico_1_1utils_a2002680e62d88f21a336fefa40f0c50c}} 
\index{calico::utils@{calico::utils}!InitializePinholeAndPoses@{InitializePinholeAndPoses}}
\index{InitializePinholeAndPoses@{InitializePinholeAndPoses}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{InitializePinholeAndPoses()}{InitializePinholeAndPoses()}}
{\footnotesize\ttfamily  Tuple\mbox{[}np.\+ndarray, List\mbox{[}np.\+ndarray\mbox{]}, List\mbox{[}np.\+ndarray\mbox{]}\mbox{]} calico.\+utils.\+Initialize\+Pinhole\+And\+Poses (\begin{DoxyParamCaption}\item[{List\mbox{[}Dict\mbox{[}int, np.\+ndarray\mbox{]}\mbox{]}}]{all\+\_\+detections,  }\item[{Dict\mbox{[}int, np.\+ndarray\mbox{]} }]{model\+\_\+definition }\end{DoxyParamCaption})}

\begin{DoxyVerb}Implements Zhang's pinhole estimation algorithm.
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr98-71.pdf
For convenience, we also return the pose of the camera w.r.t. the calibration
chart.

Args:
  measurements:
    List of calibration chart detections where each list element represents
    detections for one image frame.
  model_definition:
    Dictionary mapping feature ID of a calibration chart to its metric
    coordinate resolved in the chart's frame.

Returns:
  intrinsics:
    Pinhole parameters as a 5-vector in the order [fx, fy, s, cx, cy] such that
    K = [fx  s cx]
        [ 0 fy cy]
        [ 0  0  1]
  R_chart_camera:
    List of 3x3 
\end{DoxyVerb}
 \mbox{\Hypertarget{namespacecalico_1_1utils_a86079fbae8165d8052d293a2cad53079}\label{namespacecalico_1_1utils_a86079fbae8165d8052d293a2cad53079}} 
\index{calico::utils@{calico::utils}!SetPoseConstantInProblem@{SetPoseConstantInProblem}}
\index{SetPoseConstantInProblem@{SetPoseConstantInProblem}!calico::utils@{calico::utils}}
\doxysubsubsection{\texorpdfstring{SetPoseConstantInProblem()}{SetPoseConstantInProblem()}}
{\footnotesize\ttfamily void calico\+::utils\+::\+Set\+Pose\+Constant\+In\+Problem (\begin{DoxyParamCaption}\item[{ceres\+::\+Problem \&}]{problem,  }\item[{\mbox{\hyperlink{classcalico_1_1Pose3}{Pose3d}} \&}]{pose }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

Convenience function for setting a Pose3d object parameters constant within a ceres problem. 